<template>
	<view class="box">
		<view class="box-con">
			<view class="box-con-title">{{boxTitle}}</view>
			<input @input="inputPwd" class="box-con-input" maxlength="16" placeholder="请输入密码" :password="isShowPwd"
				type="text" v-model="pwd" />
			<view class="box-con-img" @click="changLookPwd" v-if="isShowPwd">
				<image :src="hiddenImg"></image>
			</view>
			<view class="box-con-img" @click="changLookPwd" v-else>
				<image :src="showImg"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			boxTitle: {
				type: String,
				default: '密码'
			}
		},
		data() {
			return {
				hiddenImg: require('@/static/img/login/hidden.svg'),
				showImg: require('@/static/img/login/show.svg'),
				isShowPwd: true,
				pwd: ''
			}
		},
		methods: {
			changLookPwd() {
				this.isShowPwd = !this.isShowPwd
			},
			inputPwd() {
				//console.log(this.pwd)
				this.$emit('changePwd', this.pwd)
			}
		}
	}
</script>

<style scoped lang="scss">
	.box-con {
		width: 92%;
		margin-left: 4%;
		border-bottom: 2rpx solid #eee;
		display: flex;
		height: 100rpx;
		font-size: 32rpx;

		.box-con-title {
			width: 20%;
			line-height: 100rpx;
			font-weight: 550;
		}

		.box-con-input {
			width: 60%;
			font-size: 32rpx;
			height: 50rpx;
			margin-top: 25rpx;
		}

		.box-con-img {
			width: 20%;
			text-align: center;

			image {
				width: 60rpx;
				height: 60rpx;
				margin-top: 20rpx;
			}
		}
	}
</style>
